Imports CapaDeDatos
Imports System.Data.SqlClient
Public Class nTipoTalonario
    Private TblTipoTalonario As dTipoTalonario = New dTipoTalonario()
    Public Function Insertar(ByVal Letra As String, ByVal Descripcion As String) As Boolean
        If (Descripcion <> "" And Not TblTipoTalonario.Existe(Letra, Descripcion)) Then
            Return TblTipoTalonario.Insertar(Letra, Descripcion)
        End If
        Return False
    End Function
    Public Function Listar() As DataSet
        Return TblTipoTalonario.Listar()
    End Function
    Public Function Modificar(ByVal idTipoTalonario As String, ByVal Letra As String, ByVal Descripcion As String) As Boolean
        If (Descripcion <> "" And Not TblTipoTalonario.Existe(Letra, Descripcion)) Then
            Return TblTipoTalonario.Modificar(idTipoTalonario, Letra, Descripcion)
        End If
        Return False
    End Function
    Public Function Eliminar(ByVal idTipoTalonario As String) As Boolean
        Return TblTipoTalonario.Eliminar(idTipoTalonario)
    End Function
    Public Function DescripcionLetra(ByVal idTipoTalonario As String) As DataSet
        Dim dts As DataSet
        dts = Buscar(idTipoTalonario, "", "")
        dts.Tables(0).Columns.Add("DescripcionLetra")
        Dim i As Integer
        For i = 0 To dts.Tables(0).Rows.Count - 1
            Try
                dts.Tables(0).Rows(i)("DescripcionLetra") = dts.Tables(0).Rows(i)("Descripcion").ToString() + " " + dts.Tables(0).Rows(i)("Letra").ToString()
            Catch ex As Exception
                dts.Tables(0).Rows(i)("DescripcionLetra") = "Tipo de Talonario no encontrado"
            End Try
        Next
        Return dts
    End Function
    Public Function Buscar(ByVal idTipoTalonario As String, ByVal Letra As String, ByVal Descripcion As String) As DataSet
        Return TblTipoTalonario.BuscarFiltrado(idTipoTalonario, Letra, Descripcion)
    End Function

End Class
